home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_lib.arc / FLDELETE.C < prev    next >
Text File  |  1990-08-09  |  1KB  |  54 lines

  1. /**
  2. *
  3. *  Name         fldelete -- Delete a file
  4. *
  5. *  Synopsis     ercode = fldelete(pfile);
  6. *               int  ercode       DOS function return error code
  7. *               char *pfile       Full path name of file to delete
  8. *
  9. *  Description  This function deletes the file specified in the path
  10. *               name.  Note that read only files cannot be deleted
  11. *               until their attribute is changed (use FLSETATR).
  12. *               Directories cannot be deleted with FLDELETE.
  13. *
  14. *  Returns      ercode            DOS 2.0 function return error code
  15. *
  16. *  Version      1.1  (C)Copyright Blaise Computing Inc.  1983, 1984
  17. *
  18. **/
  19. #include <compiler.h>
  20.  
  21. struct dreg
  22. {
  23.   unsigned ax,bx,cx,dx,si,di,ds,es;
  24. };
  25. #define DOSREG  struct dreg
  26.  
  27. int fldelete(pfile)
  28. char *pfile;
  29. {
  30.  
  31.     DOSREG dos_reg;
  32.     int    utinit(),dos();
  33. #if CI201A & LDATA
  34.     unsigned long ptrtoabs();
  35. #endif
  36.  
  37.     utinit(&dos_reg);                  /* Initialize registers         */
  38.     dos_reg.ax = 0x4100;               /* DOS function 41              */
  39. #if LDATA
  40. #if CI201A
  41.     dos_reg.ds = (unsigned)((ptrtoabs(pfile) & 0xffff0L) >> 4L);
  42.     dos_reg.dx = (unsigned)(ptrtoabs(pfile) & 0xfL);
  43. #else
  44.     dos_reg.ds = (unsigned)(((long)(pfile) & 0xffff0L) >> 4L);
  45.     dos_reg.dx = (unsigned)((long)(pfile) & 0xfL);
  46. #endif
  47. #else
  48.     dos_reg.dx = (unsigned)pfile;
  49. #endif
  50.  
  51.     return(dos(&dos_reg));
  52.  
  53. }
  54.